//
//  TimeLineCell.m
//  QinzTimeLine
//
//  Created by Qinz on 2017/5/23.
//  Copyright © 2017年 Qinz. All rights reserved.
//

#import "TimeLineCell.h"
#import "SDAutoLayout.h"

@interface TimeLineCell ()

@property (weak, nonatomic) IBOutlet UILabel *ttimeLB;
@property (weak, nonatomic) IBOutlet UILabel *titleLB;

@end

@implementation TimeLineCell

+ (instancetype) timeLineCell:(UITableView *) tableView{
    TimeLineCell *cell = [tableView dequeueReusableCellWithIdentifier:@"TimeLineCell"];
    if (cell == nil) {
        cell = [[[NSBundle mainBundle] loadNibNamed:@"TimeLineCell" owner:nil options:nil] firstObject];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
    }
    return cell;
}

- (void)awakeFromNib {
    [super awakeFromNib];
    
    self.pointView.sd_layout.topSpaceToView(self.contentView, 20).leftSpaceToView(self.contentView, 5).widthIs(8).heightEqualToWidth();
    self.pointView.sd_cornerRadius = @(4);
    
    self.lineView.sd_layout.topEqualToView(self.contentView).centerXEqualToView(self.pointView).widthIs(1).bottomSpaceToView(self.contentView, 0);
    
    self.ttimeLB.sd_layout.centerYEqualToView(self.pointView).leftSpaceToView(self.pointView, 10).rightSpaceToView(self.contentView, 10).heightIs(20);
    self.titleLB.sd_layout.topSpaceToView(self.ttimeLB, 15).leftEqualToView(self.ttimeLB).rightSpaceToView(self.contentView, 10).autoHeightRatio(0);
}

-(void)setModel:(TimeLineModel *)model{

    _model = model;
    self.titleLB.text=  model.title;
    self.ttimeLB.text = model.time;
    
    [self setupAutoHeightWithBottomView:self.titleLB bottomMargin:0];
}

@end
